﻿@model Jb.Web.ViewModels.CategoryViewModel
@using Jb.Web.Utility;
@using Jb.Common.Extensions;
@using Jb.Web.ViewModels.UtilityModels;
@{
    String pageTitle = "Jobs by Category";
    ListConfig _ListConfig = ViewData[AppConstants.ViewDataKeys.SUB_MODEL] as ListConfig;
    //ViewBag.DataSource = _ListConfig.DataSource;
    //ViewBag.TotalRecord = _ListConfig.Pager.TotalRecord;
    if(Model != null){
        _ListConfig.Pager.UrlFormat = "/Job/Category/" + Model.UrlName + "?pageno={0}";
    }
    if(Model != null){
        pageTitle = String.Format("Jobs by Category \"{0}\"", Model.Name);
    }
    ViewBag.Title = Html.GetPageTitle(pageTitle);
    ViewData[AppConstants.ViewDataKeys.HIDE_ADD_TO_FAVORITE] = false;
}

<div class="jb-page-heading">
    <h1>@pageTitle</h1>
    <div>@if(Model != null){
            @:Showing all jobs from the category <strong>@Model.Name</strong> 
        }
    </div>
</div>

@{String autoClass = Model == null ? String.Empty : "auto";}
<div class="jb-page-content @(autoClass)">  
    @if (Model == null){
        @Html.WarningMessageBox("Sorry! the requested Category was not found.")
    }
</div>
@if(Model != null){
<div id="divSearchResult">
    @Html.Partial("_JobList", _ListConfig.DataSource)
    @{autoClass = _ListConfig.Pager.TotalRecord > 0 ? "auto" : String.Empty;}
    <div class="jb-page-content @(autoClass)">
    @Html.Partial("_Pager", _ListConfig.Pager)
    </div>    
</div>
}

@Html.Partial("_SendToFriendModal")

@section RightSideBar
{
<div style="height:330px;">
    <ul>
        <li><h3>Space for rent</h3></li>
    </ul>    
</div>
}
    
@section JavaScriptPlaceHolder
{
@Html.JavaScript("Common.js", Url)
@Html.JavaScript("jquery.validate.min.js", Url)
@Html.JavaScript("jquery.validate.unobtrusive.min.js", Url)
@Html.Partial("_SendToFriendJS")    
}